package Dispatch.HttpHandleImpl;

import Dispatch.HttpHandle;
import HttpBean.Request.Request;
import HttpBean.Response.Response;
import HttpBean.Response.ResponseComponent;
import Utils.ControllerComponent;

public class HttpHandleControllerImpl extends HttpHandle {
    /**
     * 只处理String返回值
     * @param request
     * @return
     */
    @Override
    protected Response doResolve(Request request) {
        System.out.println("Controller");
        Object o = ControllerComponent.doFilter(request.getRequestLine().getUrl());
        if(o == null) return null;
        Response response = ResponseComponent.get("200");
        response.initResponse(request);
        response.setEntity((String) o);
        return response;
    }
}
